package com.qf.dao;

import com.qf.pojo.Type;
import com.qf.utils.ApacheUtil;
import com.qf.utils.DBUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * @author 汤奇
 * @version V1.0
 * @Project BookPro
 * @Package com.qf.dao
 * @Description:
 * @Date 2022/5/24 15:47
 */
public class TypeDaoImpl implements TypeDao {
    private QueryRunner qr = new QueryRunner(ApacheUtil.getDataSource());
    @Override
    public List<Type> findAll() {
        String sql = "select * from tb_goods_type";
        List<Type> list = null;
        try {
            list = qr.query(sql, new BeanListHandler<Type>(Type.class));
        } catch (SQLException e) {
            e.printStackTrace();

        }
        return list;
    }
}
